package ghm;

import java.sql.ResultSet;
import java.sql.SQLException;

import dao.ALGJPBean;

public class GHMBean extends ALGJPBean {

	public static final String BDName = "divers";
	public static final String tableName = "ghm";

	public static final String idColumnName = "id";
	private int id;

	public static final String libelleColumnName = "libelle";
	private String libelle;

	public static final String img1ColumnName = "question";
	private String img1 = null;

	public static final String img2ColumnName = "reponse1";
	private String img2 = null;
	public static final String img3ColumnName = "reponse2";
	private String img3 = null;
	public static final String img4ColumnName = "reponse3";
	private String img4 = null;
	public static final String img5ColumnName = "reponse4";
	private String img5 = null;
	public static final String img6ColumnName = "reponse5";
	private String img6 = null;

	public GHMBean() {
	}

	public GHMBean(ResultSet rs) throws SQLException {
		populate(rs);
	}

	private void populate(ResultSet rs) throws SQLException {
		setId(rs.getInt(idColumnName));
		setLibelle(rs.getString(libelleColumnName));
		setImg1(rs.getString(img1ColumnName));
		setImg2(rs.getString(img2ColumnName));
		setImg3(rs.getString(img3ColumnName));
		setImg4(rs.getString(img4ColumnName));
		setImg5(rs.getString(img5ColumnName));
		setImg6(rs.getString(img6ColumnName));
	}

	public void addReponse(String rep) {
		if (img2 == null) {
			img2 = rep;
		} else if (img3 == null) {
			img3 = rep;
		} else if (img4 == null) {
			img4 = rep;
		} else if (img5 == null) {
			img5 = rep;
		} else if (img6 == null) {
			img6 = rep;
		} else {
			System.out.println("Plus de place pour la reponse...");
		}
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getLibelle() {
		return libelle;
	}

	public void setLibelle(String libelle) {
		this.libelle = libelle;
	}

	public String getImg1() {
		return img1;
	}

	public void setImg1(String img1) {
		this.img1 = img1;
	}

	public String getImg2() {
		return img2;
	}

	public void setImg2(String img2) {
		this.img2 = img2;
	}

	public String getImg3() {
		return img3;
	}

	public void setImg3(String img3) {
		this.img3 = img3;
	}

	public String getImg4() {
		return img4;
	}

	public void setImg4(String img4) {
		this.img4 = img4;
	}

	public String getImg5() {
		return img5;
	}

	public void setImg5(String img5) {
		this.img5 = img5;
	}

	public String getImg6() {
		return img6;
	}

	public void setImg6(String img6) {
		this.img6 = img6;
	}

	public static String getImg3ColumnName() {
		return img3ColumnName;
	}

	public static String getImg4ColumnName() {
		return img4ColumnName;
	}

	public static String getImg5ColumnName() {
		return img5ColumnName;
	}

	public static String getImg6ColumnName() {
		return img6ColumnName;
	}

	public Object getPKValue() {
		return libelle;
	}

	public String getPkColumnName() {
		return libelleColumnName;
	}

	public String getPkPropertieName() {
		return "libelle";
	}
}
